PEGetNthSortField

Use PEGetNthSortField to return information about one of the sort fields in the specified report. This function returns the name of the field and the direction (ascending or descending) of the sort. The name of the sort field is returned as a string handle. This function is typically used as one of a series of functions (PEGetNSortFields called once; PEGetNthSortField and PEGetHandleString called together as many times as needed to identify the correct sort field; and PESetNthSortField called once when the correct sort field is identified). The series can be used in a Custom-Print Link to identify and then change an existing sort field and/or sort order in response to a user selection at print time.

C Syntax
BOOL CRPE_API PEGetNthSortField (
        short printJob,
        short sortFieldN,
        HANDLE FAR *nameHandle,
        short FAR *nameLength,
        short FAR *direction );
Parameters

printJob

Specifies the print job from which you want to retrieve sort field information.

sortFieldN

Specifies the0-based number of the sort field you want to retrieve. The first sort field is field 0. If the report has N sort fields, the function can be called with sortFieldN between 0 and N-1.

nameHandle

Specifies a pointer to the handle of the string containing the sort field name.

nameLength

Specifies a pointer to the length of the field name string (in bytes) including the terminating byte.

direction

Specifies a pointer to the sort direction. Uses one of the PE_SF_XXX Sort Order Constants.

Returns
VB Syntax

VB Sample Code for sorting records

Declare Function PEGetNthSortField Lib "crpe32.dll" ( _
    ByVal printJob As Integer, ByVal SortNumber As Integer, _
    NameHandle As Long, NameLength As Integer, Direction As Integer _
    ) As Integer
Delphi Syntax
function PEGetNthSortField (
    printJob: Word;
    sortFieldN: integer;
    var nameHandle: HWnd;
    var nameLength: Word;
    var direction: Word
    ): Bool stdcall;


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com